<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Medium
  </div>
  <div>
   <h1 class="question_title">
    59. Spiral Matrix II
   </h1>
   <p>
    Given a positive integer
    <em>
     n
    </em>
    , generate a square matrix filled with elements from 1 to
    <em>
     n
    </em>
    <sup>
     2
    </sup>
    in spiral order.
   </p>
   <p>
    <strong>
     Example:
    </strong>
   </p>
   <pre>
<strong>Input:</strong> 3
<strong>Output:</strong>
[
 [ 1, 2, 3 ],
 [ 8, 9, 4 ],
 [ 7, 6, 5 ]
]
</pre>
  </div>
  <div>
   <h1 class="question_title">
    59. 螺旋矩阵 II
   </h1>
   <p>
    给定一个正整数&nbsp;
    <em>
     n
    </em>
    ，生成一个包含 1 到&nbsp;
    <em>
     n
    </em>
    <sup>
     2
    </sup>
    &nbsp;所有元素，且元素按顺时针顺序螺旋排列的正方形矩阵。
   </p>
   <p>
    <strong>
     示例:
    </strong>
   </p>
   <pre><strong>输入:</strong> 3
<strong>输出:</strong>
[
 [ 1, 2, 3 ],
 [ 8, 9, 4 ],
 [ 7, 6, 5 ]
]</pre>
  </div>
 </body>
</html>